package net.wzw.rule;

import lombok.extern.slf4j.Slf4j;
import org.jeasy.rules.annotation.Action;
import org.jeasy.rules.annotation.Condition;
import org.jeasy.rules.annotation.Fact;
import org.jeasy.rules.annotation.Rule;


/**
 * @author wzw
 * @date 2025/4/2
 * @Description 下雨告警规则
 */
//定义规则
@Slf4j
@Rule(name = "下雨规则", description = "当湿度大于80°触发告警", priority = 2)
public class RainRule {


    @Condition //标记条件
    public boolean isRaining(@Fact("humidity") int humidity) {

        return humidity > 80;
    }

    @Action
    public void remind() {

        //短信通知，邮件通知,微信通知，语音通知等
        log.info("下雨消息通知={}", "告警成功!");

    }


}
